<script>
// Upload Image  
var finishUpload = function(){


        var uploadData = jQuery("#upload_target").contents().find('html body').html()
        jQuery("#gallery_items").html(uploadData);
        // alert("Sdfsdfs");

        jQuery("#image_picture").attr("value", "");
        jQuery("#image_title").attr("value", "");
	
	// Image actions menu
			jQuery('ul.imageList li').hover(
				function() { jQuery(this).find('ul').css('display', 'none').slideDown('fast').css('display', 'block'); },
				function() { jQuery(this).find('ul').slideUp('fast'); }
			);
	
	//modal image view functionality
				jQuery('.imageList a.image-modal').click(function (e) {
					e.preventDefault();
					show_image(this.href);
				  });
        

};

function TestFileUpload()
{
	if (jQuery("#image_picture").attr("value") == "")
	{
		alert("Please select a image file to upload !");
		return false;
	}
        loading_area('<%= image_tag "loading_ajax.gif" %>', "#gallery_items", "#gallery_items");
        $.fancybox.close();
	return true;
};

</script>


                                                          
							  
							  
							  
							  
							  
							  
							  
							<div id="gallery_items">
								<%= render "/images/small_gallery_items" %>
							</div>
							  
							  
							  
							  
                                                                                                                       
                                                              <!-- UPLOAD IMAGE -->
                                                              <% form_tag({:controller => "images", :action => 'upload'}, :multipart=>true, :target => 'upload_target', :onSubmit => "return TestFileUpload()" ) do %>
								<iframe id="upload_target" name="upload_target" src="" style="display: none" ></iframe>
                                                                <h2>Upload Image</h2>
                                                                <p><small><strong>Image name:</strong><br />
                                                                  <input id="image_title" type="text" name="image[title]"  value="" /><br />
                                                                  <strong>Location:</strong><br /><input id="image_picture" type="file" name="image[picture]"  value="" />
                                                                  </p>
                                                                  <p><input id="FormName_Button" class="button blue fl-space" type="submit" value="Upload" /></p>
                                                                  <input type="hidden" name="image[event_id]" value="<%= @event.id %>" />
                                                                </small></p>
                                                              <% end %>
                                                              <!-- END UPLOAD -->
                                                              
                                                          
                                                  